﻿using System;
using System.Windows;
using System.Windows.Threading;
using System.ServiceModel;
using System.ServiceModel.Channels;

namespace SBPweb.PROvibe.Client.Framework.Content
{

    public class ConnectorClient : Connector.ContentProviderClient
    {

        public ConnectorClient()
            : base(CreateBindingInstance(), new EndpointAddress(string.Format("{0}/Services/ContentProvider.svc", GetContentRoot(Application.Current.Host.Source.OriginalString))))
        {
        }

        public static Binding CreateBindingInstance()
        {
            //PollingDuplexHttpBinding ret = new PollingDuplexHttpBinding();
            BasicHttpBinding ret = new BasicHttpBinding(BasicHttpSecurityMode.None);
            return ret;
        }

        public static string GetContentRoot(string entryXapPath)
        {
            return entryXapPath.Substring(0, entryXapPath.IndexOf("ClientBin") - 1);
        }

    }

}
